
using System;
using System.Runtime.InteropServices;

namespace Bioscrypt
{
    [StructLayout(LayoutKind.Sequential)]
    public struct TemplateStruct
    {
        /// <summary>
        /// Template ID number.
        /// </summary>
        [MarshalAs(UnmanagedType.U4)]
        public int Id;

        /// <summary>
        /// Optional employee Id
        /// </summary>
        [MarshalAs(UnmanagedType.U4)]
        public int EmployeeId;

        /// <summary>
        /// Optional administration password.
        /// </summary>
        [MarshalAs(UnmanagedType.U4)]
        public int Password;

        /// <summary>
        /// Specifies sensor type/version.
        /// </summary>
        internal byte SensorVersion;

        /// <summary>
        /// Specifies template version.
        /// </summary>
        internal byte TemplateVersion;

        /// <summary>
        /// Optional name.
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
        public byte[] Name;

        /// <summary>
        /// Finger enrolled (0-9 is left pinky to right pinky)
        /// </summary>
        public byte Finger;

        /// <summary>
        /// Administration privileges.
        /// </summary>
        public byte AdminLevel;

        /// <summary>
        /// Optional template use schedule.
        /// </summary>
        public byte Schedule;

        /// <summary>
        /// Template specific security level.
        /// </summary>
        public byte SecurityThresh;

        /// <summary>
        /// Noise level.
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)]
        internal byte[] NoiseLevel;

        const int NUM_CORE = 3;

        /// <summary>
        /// Core stats.
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = NUM_CORE)]
        internal byte[] CoreStats;

        /// <summary>
        /// Horizontal core locations.
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = NUM_CORE)]
        internal byte[] HorizontalCore;

        /// <summary>
        /// Vertical core locations.
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = NUM_CORE)]
        internal byte[] VerticalCore;

        internal byte TempXOffset;
        internal byte TempYOffset;

        /// <summary>
        /// Template index (refers to a specific instance of an Id)
        /// </summary>
        public byte Index;

        const int PACKED_ARRAY_SIZE = 5500;

        /// <summary>
        /// Fingerprint data.
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = PACKED_ARRAY_SIZE)]
        internal byte[] Inphase;
    }
}
